# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=padoracle
pkgver=v0.1.1.r26.g2aa6c99
pkgrel=1
pkgdesc='Padding Oracle Attack with Node.js.'
arch=('any')
groups=('blackarch' 'blackarch-crypto')
url='https://github.com/imyelo/padoracle'
license=('Apache')
depends=('nodejs')
makedepends=('npm' 'git')
source=("git+https://github.com/imyelo/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
  cd $pkgname

  _npmdir="$pkgdir/usr/lib/node_modules/"

  install -dm 755 "$_npmdir"

  cd "$_npmdir"

  npm install --user root -g --prefix "$pkgdir/usr" "$pkgname@"

  cd "$srcdir/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
}

